package com.lxy.elasticsearch200.base.enums.result;

import com.lxy.elasticsearch200.base.enums.base.BaseEnum;

/**
 * 接口响应状态码定义枚举
 *
 * @author admin
 * @since 2023-8-9
 */
public enum ResultEnum implements BaseEnum<Integer> {

    SUCCESS(200, "请求成功！"),
    NOT_FIND_RESOURCE_ERROR(404, "请求的资源不存在！"),
    ERROR(500, "请求失败！"),
    CSRF_ERROR(600, "非法请求！"),
    PARAM_ERROR(610, "参数错误！"),

    USER_NOT_LOGIN_ERROR(1000, "用户未登录！"),
    USER_LOCK_ERROR(1030, "当前帐号已被锁定，请联系管理员解决!"),
    USER_LOGIN_ACCOUNT_ERROR(1040, "用户名或密码错误!"),
    USER_LOGIN_PWD_ERROR(1050, "用户或密码错误，当前还可以试%s次!"),
    INPUT_ACCOUNT_OR_PWD_ERROR(1052, "当日连续输入密码错误次数已达上限，当前帐号已被限制登录!"),
    USER_LOGIN_DEVICE_ERROR(1060, "登录设备缺失！"),
    VALID_USER_TYPE_ERROR(1062, "无效的用户类型！"),
    USER_NOT_ALLOW_ROLE_ERROR(1065, "用户尚未分配角色！"),
    INSUFFICIENT_ROLE_ERROR(1090, "该功能只有指定角色可以访问！"),
    INSUFFICIENT_AUTHORITY_ERROR(1100, "权限不足，请联系管理员处理！"),
    ACCOUNT_DISABLE_ERROR(1200, "您的账号已被禁用，将于%s秒后解封！"),
    GLOBAL_AUTH_ERROR(1300, "全局认证失败！"),

    ;

    /**
     * 枚举code
     */
    private Integer code;

    /**
     * 枚举描述
     */
    private String desc;

    ResultEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    @Override
    public Integer getCode() {
        return code;
    }

}
